<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/common/jsp/global.jsp"%>
<script>

    var table={scaffoldXmlFieldList:'${fieldsList}'};
</script>
<div class="wrapper-md" ng-controller="configTableEditCtrl">
    <div>
        <form name="mscUsersOrgForm" class="form-validation" >
            <div class="panel panel-default">
                <div class="panel-heading">
                    <i class="glyphicon glyphicon-edit"></i>
                    <span class="h4">表设计</span>

                </div>
                <div class="panel-body">

                    <div class="form-group pull-in clearfix">
                        <div class="col-sm-6">
                            <label>表名</label>
                            <input type="hidden" class="form-control" ng-model="formData.module" ng-init="formData.module='${param.module}'" />
                            <input type="text" class="form-control" ng-model="formData.tableName" ng-init="formData.tableName='${configTable.tableName}'" />
                        </div>
                        <div class="col-sm-6">
                            <label>状态</label>
                            <input type="text" class="form-control"  ng-model="formData.status" ng-init="formData.status='${configTable.status}'">
                        </div>
                    </div>
                    <div class="form-group pull-in clearfix">
                        <div class="col-sm-12">
                            <label>描述</label>
                            <input type="text" class="form-control"  ng-model="formData.tableInfo" ng-init="formData.tableInfo='${configTable.tableInfo}'">
                        </div>
                    </div>
                    <div class="form-group pull-in clearfix">
                        <div class="col-sm-12">
                            字段列表
                        </div>
                    </div>
                    <div class="form-group pull-in clearfix">
                        <div class="col-sm-12 table-responsive">
                            <table class="table table-striped b-t b-light">
                                <tr>
                                    <th>字段</th>
                                    <th>名称</th>
                                    <th>数据库类型</th>
                                    <th>长度</th>
                                    <th>java类型</th>
                                    <th>必填</th>
                                    <th>外键字段id</th>
                                    <th>外键字段名称</th>
                                    <th><a href="javascript:void(0)" ng-click="addFields()">添加</a></th>
                                </tr>
                                <tr ng-repeat="item in fields" >
                                    <td>{{item.filedId}}</td>
                                    <td>{{item.filedName}}</td>
                                    <td>{{item.filedType}}</td>
                                    <td>{{item.filedLength}}</td>
                                    <td>{{item.javaType}}</td>
                                    <td>{{item.required}}</td>
                                    <td>{{item.foreignId}}</td>
                                    <td>{{item.foreignName}}</td>
                                    <td>
                                        <a href="javascript:void(0)" ng-click="editFields(item.filedId)">编辑</a>
                                        <a href="javascript:void(0)" ng-click="delFields(item.filedId)">删除</a>
                                    </td>
                                </tr>
                            </table>
                        </div>

                    </div>



                    <div class="form-group align-center">
                        <button type="button" class="btn btn-default" ng-click="submitSave('${param.module}')">保存</button>
                        <button type="button" class="btn btn-default" ng-return>返回</button>
                    </div>


                </div>
            </div>
        </form>
    </div>
</div>
